package cn.IT.service.impl;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.IT.dao.IUserDAO;
import cn.IT.domain.User;
import cn.IT.service.IUserService;

@Service(value = "userService")
@SuppressWarnings("all")
@Transactional
public class UserService implements IUserService {

	@Resource
	private IUserDAO userDao;

	@Override
	public List<User> getAllUsers() {
		return userDao.findAll(User.class);
	}
	
	@Override
	public List<User> getAllUserExceptSelf(User user) {
		return userDao.getAllUserExceptSelf(user);
	}
	
	@Override
	public List<User> getAllApproversExceptSelf(User user) {
		return userDao.getAllApproversExceptSelf(user);
	}

	@Override
	public User login(User user) {
		return userDao.getUserByNameAndPassword(user);
	}

	@Override
	public User getUserById(Serializable userId) {
		return userDao.get(User.class, userId);
	}
	
	@Override
	public List<User> getAllUserOrderByContribute() {
		return userDao.getAllUserOrderByContribute();
	}


}
